package com.sailfish.gateway.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.core.env.Environment;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author XIAXINYU3
 * @date 2021/3/24
 */
@RefreshScope
@RestController
@RequestMapping("/test")
public class TestController {
    @Autowired
    private Environment env;


    private String version = "0";

    @GetMapping("/port")
    public Object port() {
        return String.format("port=%s, version=%s", env.getProperty("local.server.port"), version);
    }
}
